# dash_apps.py
import dash
from dash import dcc, html
import plotly.express as px
import pandas as pd


def create_dash_app(requests_pathname_prefix):
    app = dash.Dash(
        __name__,
        requests_pathname_prefix=requests_pathname_prefix
    )

    df = pd.DataFrame({
        "Fruit": ["苹果", "橙子", "香蕉", "苹果", "橙子", "香蕉"],
        "Amount": [4, 1, 2, 2, 4, 5]
    })

    fig = px.bar(df, x="Fruit", y="Amount", color="Fruit")

    app.layout = html.Div([
        html.H1('水果销售情况'),
        dcc.Graph(figure=fig)
    ])

    return app